package com.qj.yantaishan.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import com.qj.yantaishan.mapper.ProductToGroupMapper;
import com.qj.yantaishan.domain.ProductToGroup;
import com.qj.yantaishan.service.IProductToGroupService;
import com.qj.yantaishan.common.core.text.Convert;

/**
 * 商品分组关联Service业务层处理
 * 
 * @author qihe
 * @date 2022-07-22
 */
@Service
@Primary
public class ProductToGroupServiceImpl    extends ServiceImpl<ProductToGroupMapper, ProductToGroup>  implements IProductToGroupService
{
    @Autowired
    private ProductToGroupMapper productToGroupMapper;

    /**
     * 查询商品分组关联
     * 
     * @param productId 商品分组关联主键
     * @return 商品分组关联
     */
    @Override
    public ProductToGroup selectProductToGroupByProductId(Long productId)
    {
        return productToGroupMapper.selectProductToGroupByProductId(productId);
    }

    /**
     * 查询商品分组关联列表
     * 
     * @param productToGroup 商品分组关联
     * @return 商品分组关联
     */
    @Override
    public List<ProductToGroup> selectProductToGroupList(ProductToGroup productToGroup)
    {
        return productToGroupMapper.selectProductToGroupList(productToGroup);
    }

    /**
     * 新增商品分组关联
     * 
     * @param productToGroup 商品分组关联
     * @return 结果
     */
    @Override
    public int insertProductToGroup(ProductToGroup productToGroup)
    {
        return productToGroupMapper.insertProductToGroup(productToGroup);
    }

    /**
     * 修改商品分组关联
     * 
     * @param productToGroup 商品分组关联
     * @return 结果
     */
    @Override
    public int updateProductToGroup(ProductToGroup productToGroup)
    {
        return productToGroupMapper.updateProductToGroup(productToGroup);
    }

    /**
     * 批量删除商品分组关联
     * 
     * @param productIds 需要删除的商品分组关联主键
     * @return 结果
     */
    @Override
    public int deleteProductToGroupByProductIds(String productIds)
    {
        return productToGroupMapper.deleteProductToGroupByProductIds(Convert.toStrArray(productIds));
    }

    /**
     * 删除商品分组关联信息
     * 
     * @param productId 商品分组关联主键
     * @return 结果
     */
    @Override
    public int deleteProductToGroupByProductId(Long productId)
    {
        return productToGroupMapper.deleteProductToGroupByProductId(productId);
    }
}
